<?php
+use Wikimedia\TestingAccessWrapper;
+
/**
* @group FileRepo
* @group FileBackend
* @group medium
+ *
+ * @covers FileBackend
+ *
+ * @covers CopyFileOp
+ * @covers CreateFileOp
+ * @covers DeleteFileOp
+ * @covers DescribeFileOp
+ * @covers FSFile
+ * @covers FSFileBackend
+ * @covers FSFileBackendDirList
+ * @covers FSFileBackendFileList
+ * @covers FSFileBackendList
+ * @covers FSFileOpHandle
+ * @covers FileBackendDBRepoWrapper
+ * @covers FileBackendError
+ * @covers FileBackendGroup
+ * @covers FileBackendMultiWrite
+ * @covers FileBackendStore
+ * @covers FileBackendStoreOpHandle
+ * @covers FileBackendStoreShardDirIterator
+ * @covers FileBackendStoreShardFileIterator
+ * @covers FileBackendStoreShardListIterator
+ * @covers FileJournal
+ * @covers FileOp
+ * @covers FileOpBatch
+ * @covers HTTPFileStreamer
+ * @covers LockManagerGroup
+ * @covers MemoryFileBackend
+ * @covers MoveFileOp
+ * @covers MySqlLockManager
+ * @covers NullFileJournal
+ * @covers NullFileOp
+ * @covers StoreFileOp
+ * @covers TempFSFile
+ *
+ * @covers FSLockManager
+ * @covers LockManager
+ * @covers NullLockManager
*/
class FileBackendTest extends MediaWikiTestCase {
'backends' => [
[
'name' => 'localmultitesting1',
- 'class' => 'FSFileBackend',
+ 'class' => FSFileBackend::class,
'containerPaths' => [
'unittest-cont1' => "{$tmpDir}/localtestingmulti1-cont1",
'unittest-cont2' => "{$tmpDir}/localtestingmulti1-cont2" ],
],
[
'name' => 'localmultitesting2',
- 'class' => 'FSFileBackend',
+ 'class' => FSFileBackend::class,
'containerPaths' => [
'unittest-cont1' => "{$tmpDir}/localtestingmulti2-cont1",
'unittest-cont2' => "{$tmpDir}/localtestingmulti2-cont2" ],
/**
* @dataProvider provider_testIsStoragePath
- * @covers FileBackend::isStoragePath
*/
public function testIsStoragePath( $path, $isStorePath ) {
$this->assertEquals( $isStorePath, FileBackend::isStoragePath( $path ),
/**
* @dataProvider provider_testSplitStoragePath
- * @covers FileBackend::splitStoragePath
*/
public function testSplitStoragePath( $path, $res ) {
$this->assertEquals( $res, FileBackend::splitStoragePath( $path ),
/**
* @dataProvider provider_normalizeStoragePath
- * @covers FileBackend::normalizeStoragePath
*/
public function testNormalizeStoragePath( $path, $res ) {
$this->assertEquals( $res, FileBackend::normalizeStoragePath( $path ),
/**
* @dataProvider provider_testParentStoragePath
- * @covers FileBackend::parentStoragePath
*/
public function testParentStoragePath( $path, $res ) {
$this->assertEquals( $res, FileBackend::parentStoragePath( $path ),
/**
* @dataProvider provider_testExtensionFromPath
- * @covers FileBackend::extensionFromPath
*/
public function testExtensionFromPath( $path, $res ) {
$this->assertEquals( $res, FileBackend::extensionFromPath( $path ),
$this->tearDownFiles();
}
- /**
- * @covers FileBackend::doOperation
- */
private function doTestStore( $op ) {
$backendName = $this->backendClass();
/**
* @dataProvider provider_testCopy
- * @covers FileBackend::doOperation
*/
public function testCopy( $op ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testMove
- * @covers FileBackend::doOperation
*/
public function testMove( $op ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testDelete
- * @covers FileBackend::doOperation
*/
public function testDelete( $op, $withSource, $okStatus ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testDescribe
- * @covers FileBackend::doOperation
*/
public function testDescribe( $op, $withSource, $okStatus ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testCreate
- * @covers FileBackend::doOperation
*/
public function testCreate( $op, $alreadyExists, $okStatus, $newSize ) {
$this->backend = $this->singleBackend;
return $cases;
}
- /**
- * @covers FileBackend::doQuickOperations
- */
public function testDoQuickOperations() {
$this->backend = $this->singleBackend;
$this->doTestDoQuickOperations();
/**
* @dataProvider provider_testGetFileStat
- * @covers FileBackend::getFileStat
*/
public function testGetFileStat( $path, $content, $alreadyExists ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testGetFileStat
- * @covers FileBackend::streamFile
*/
public function testStreamFile( $path, $content, $alreadyExists ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testGetFileContents
- * @covers FileBackend::getFileContents
- * @covers FileBackend::getFileContentsMulti
*/
public function testGetFileContents( $source, $content ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testGetLocalCopy
- * @covers FileBackend::getLocalCopy
*/
public function testGetLocalCopy( $source, $content ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testGetLocalReference
- * @covers FileBackend::getLocalReference
*/
public function testGetLocalReference( $source, $content ) {
$this->backend = $this->singleBackend;
return $cases;
}
- /**
- * @covers FileBackend::getLocalCopy
- * @covers FileBackend::getLocalReference
- */
public function testGetLocalCopyAndReference404() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
/**
* @dataProvider provider_testGetFileHttpUrl
- * @covers FileBackend::getFileHttpUrl
*/
public function testGetFileHttpUrl( $source, $content ) {
$this->backend = $this->singleBackend;
/**
* @dataProvider provider_testPrepareAndClean
- * @covers FileBackend::prepare
- * @covers FileBackend::clean
*/
public function testPrepareAndClean( $path, $isOK ) {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
}
- /**
- * @covers FileBackend::clean
- */
private function doTestRecursiveClean() {
$backendName = $this->backendClass();
}
}
- /**
- * @covers FileBackend::doOperations
- */
public function testDoOperations() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
"Correct file SHA-1 of $fileC" );
}
- /**
- * @covers FileBackend::doOperations
- */
public function testDoOperationsPipeline() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
"Correct file SHA-1 of $fileC" );
}
- /**
- * @covers FileBackend::doOperations
- */
public function testDoOperationsFailing() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
"Correct file SHA-1 of $fileA" );
}
- /**
- * @covers FileBackend::getFileList
- */
public function testGetFileList() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
}
}
- /**
- * @covers FileBackend::getTopDirectoryList
- * @covers FileBackend::getDirectoryList
- */
public function testGetDirectoryList() {
$this->backend = $this->singleBackend;
$this->tearDownFiles();
$this->assertEquals( [], $items, "Directory listing is empty." );
}
- /**
- * @covers FileBackend::lockFiles
- * @covers FileBackend::unlockFiles
- */
public function testLockCalls() {
$this->backend = $this->singleBackend;
$this->doTestLockCalls();
$status = Status::newGood();
$sl = $this->backend->getScopedFileLocks( $paths, LockManager::LOCK_EX, $status );
- $this->assertInstanceOf( 'ScopedLock', $sl,
+ $this->assertInstanceOf( ScopedLock::class, $sl,
"Scoped locking of files succeeded ($backendName)." );
$this->assertEquals( [], $status->getErrors(),
"Scoped locking of files succeeded ($backendName)." );
$be = TestingAccessWrapper::newFromObject( new MemoryFileBackend(
[
'name' => 'testing',
- 'class' => 'MemoryFileBackend',
+ 'class' => MemoryFileBackend::class,
'wikiId' => 'meow',
'mimeCallback' => $mimeCallback
]
'backends' => [
[ // backend 0
'name' => 'multitesting0',
- 'class' => 'MemoryFileBackend',
+ 'class' => MemoryFileBackend::class,
'isMultiMaster' => false,
'readAffinity' => true
],
[ // backend 1
'name' => 'multitesting1',
- 'class' => 'MemoryFileBackend',
+ 'class' => MemoryFileBackend::class,
'isMultiMaster' => true
]
]
'backends' => [
[ // backend 0
'name' => 'multitesting0',
- 'class' => 'MemoryFileBackend',
+ 'class' => MemoryFileBackend::class,
'isMultiMaster' => false
],
[ // backend 1
'name' => 'multitesting1',
- 'class' => 'MemoryFileBackend',
+ 'class' => MemoryFileBackend::class,
'isMultiMaster' => true
]
],
]
];
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$actual = $be->sanitizeOpHeaders( $input );
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
$this->assertEquals( $expected, $actual, "Header sanitized properly" );
}